<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
 <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>  
 <%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%>  
 <%@ taglib prefix="page" uri="http://www.yf1701.com/tags" %> 
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<base target="${cxt }/">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>订单</title>
	<style type="text/css">
			
			.wrap_right{
				width: 1000px;
				height:740px;
				margin-left: 300px;
				margin-top: -600px;
			}
		
			.wrap_right1{
				width: 1000px;
				height: 50px;
				border: 1px solid #DDDDDD;
			}
			
			.wrap_right1 span{
				
				font-size: 18px;
				line-height: 50px;
				margin-left: 10px;
			}
			
			.wrap_right2{
				width: 1000px;
				
				border: 1px solid #DDDDDD;
				
				margin-top: 10px;
			}
				
			.wrap_right2 table{
    			width: 960px;
    			border: 1px;
    			height:540px;
    			margin-left: 20px;
    			font-size: 10px;
    			text-align: center;
			}
			
			.div_tr{
				background: #f3f3f3;
				border-top: 4px solid #fff;
				overflow:auto;
			}
			
			.div_tr_div{
				width:500px;
				height: 45px;
				
				margin-left: 10px;
				margin-top: 10px;
			}
			
			
			.div_tr_div li{
				list-style: none;
				float: left;
				margin-right: 30px;
				margin-left: 0px;
				width: 70px;
				border: 1px solid #DDDDDD;
				border-radius: 5px;
				text-align: center;
				color: black;
				font-size: 15px;
			}
			.div_tr_div li:hover{
				background: #0066FF;
				cursor: pointer;
			}
			
		</style>
		
		<script src="js/index/jquery-2.1.3.min.js"></script>
		<script type="text/javascript">
					
		$(function(){
			
			$("[order_id]").click(function(){
				var msg = "您真的确定要取消吗？\n\n请确认！"; 
				 if (confirm(msg)==true){
				var od = $(this);
				//获取a标签选中的id值
				var roder_id = $(this).attr("order_id");
				$.get("delorder",{id:roder_id},function(data,success){	
					if(data=="取消订单成功！"){
						alert(data);
						console.log($(this));
						location.href = "/fuhe/order";
					}
					alert(data);
					
					
				},"text")
			}
				 
				 else{
				return false;
			}
		
		})
			
			
})


	function search(){
		//传递模糊查询的值，根据车辆名称查询
		var order = $("input[name=searchorder]").val();
		//根据车辆名称、地址、租车人、租车地址、状态查询；
		
		if(order==null){
			alert("请输入需要模糊查询的车辆名称");
			$("input[name=searchorder]").focus();
			return;
			
		}
		//首先判断order是否为空，如果为空则查询所有，
		
		 $.ajax({
				url:"sn",
				type:"get",
				data:{order:order},
				datatype:"json",
				success:function(e){
					$("input[name=searchorder]").focus();
				
					
		}
		 
			
	});
		
		
		
		}



		
	</script>	

</head>
	<body>
		<div class="wrap_right">
			
			
			<div class="wrap_right1">
			<span>订单管理</span>
			<input style="margin-left:600px;height:25px;"name="searchorder"/>
			<input type="button" value="查询" style="height:30px;width:60px;" onclick="search()" >
			</div>
			
				<div class="wrap_right2">
					<table>
					<tr style="height: 34px;font-size: 15px;">
						
						<th>商品</th>
						<th>金额</th>
						<th>服务时间</th>
						<th>地址</th>
						<th>租车人</th>
						<th>身份证</th>
						<th>状态</th>
						<th>操作</th>
					</tr>
					
	
		<c:forEach items="${orderList.data}" var="od">
            <tr class="div_tr">
                <td value="${fn:length(orderList.data) }">${od.carname}</td>
                <td>${od.rent}</td>
                <td>${od.get_car_time}</td>
                <td>${od.useraddress}</td>
                 <td>${od.useraddressname}</td>
                <td>${od.idcard}</td>
                
                <td class="state">${od.state}</td>
                <td>
                	<a order_id="${od.orderid }" name="delete">取消订单</a>
                	<c:if test="${od.state =='已下单' }">
                		<a href="/fuhe/payfifth?order_id=${od.orderid}">去付款</a>
                	</c:if>
                </td>
               
            </tr>
        </c:forEach>
	
				</table>
				
				
				
				<div class="div_tr_div">
					<page:page pages="${orderList.pages }" 
						total="${orderList.total }"
						url="order"
						currpage="${orderList.currpage }"
						pagesize="${orderList.pagesize }" />
					
				</div>
					
			
			
				</div>
		
		
	
		</div>
</body>
</html>